123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466 |
- 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 (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.condManFlag1.Count > 0)
- {
- for (int num4 = 0; num4 < yotogi.condManFlag1.Count; num4++)
- {
- if (GameMain.Instance.CharacterMgr.status.GetFlag(yotogi.condManFlag1[num4]) < 1)
- {
- return false;
- }
- }
- }
- if (yotogi.condManFlag0.Count > 0)
- {
- for (int num5 = 0; num5 < yotogi.condManFlag0.Count; num5++)
- {
- if (GameMain.Instance.CharacterMgr.status.GetFlag(yotogi.condManFlag0[num5]) > 0)
- {
- return false;
- }
- }
- }
- if (yotogi.condContract.Count > 0)
- {
- bool flag5 = false;
- for (int num6 = 0; num6 < yotogi.condContract.Count; num6++)
- {
- if (yotogi.condContract[num6] == maid.status.contract)
- {
- flag5 = true;
- break;
- }
- }
- if (!flag5)
- {
- return false;
- }
- }
- if (yotogi.condFacilityID.Count > 0)
- {
- foreach (List<int> list in yotogi.condFacilityID)
- {
- bool flag6 = false;
- foreach (int num7 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 == num7)
- {
- if (facility.IsOperation(scheduleTime))
- {
- flag6 = true;
- Maid[] allocationMaidArray = facility.GetAllocationMaidArray(scheduleTime);
- if (allocationMaidArray != null && allocationMaidArray.Length == facility.minMaidCount)
- {
- foreach (Maid y in allocationMaidArray)
- {
- if (maid == y)
- {
- flag6 = false;
- break;
- }
- }
- }
- if (flag6)
- {
- break;
- }
- }
- }
- }
- if (flag6)
- {
- break;
- }
- }
- if (!flag6)
- {
- ScheduleAPI.log("対象の施設が稼動していない");
- return false;
- }
- }
- }
- if (ScheduleCSVData.YotogiData[workId].condMainChara && !maid.status.mainChara)
- {
- return false;
- }
- if (yotogi.condPersonal.Count > 0)
- {
- bool flag7 = false;
- for (int num10 = 0; num10 < yotogi.condPersonal.Count; num10++)
- {
- if (maid.status.personal.id == yotogi.condPersonal[num10])
- {
- flag7 = (!yotogi.isCheckGP002Personal || PluginData.IsEnabledForGP002Personal(maid.status.personal.uniqueName));
- break;
- }
- }
- if (!flag7)
- {
- 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;
- }
- }
- }
|