public static void UpdateState(OCIChar _ociChar, ChaFileStatus _status) { ChaFileStatus charFileStatus = _ociChar.charFileStatus; charFileStatus.Copy(_status); for (int _id = 0; _id < charFileStatus.clothesState.Length; ++_id) { _ociChar.SetClothesState(_id, charFileStatus.clothesState[_id]); } for (int _id = 0; _id < charFileStatus.showAccessory.Length; ++_id) { _ociChar.ShowAccessory(_id, charFileStatus.showAccessory[_id]); } int[] array1 = Singleton <Character> .Instance.chaListCtrl.GetCategoryInfo(_ociChar.sex != 0?ChaListDefine.CategoryNo.custom_eyebrow_f : ChaListDefine.CategoryNo.custom_eyebrow_m).Keys.ToArray <int>(); _ociChar.charInfo.ChangeEyebrowPtn(!((IEnumerable <int>)array1).Contains <int>(charFileStatus.eyebrowPtn) ? 0 : charFileStatus.eyebrowPtn, true); int[] array2 = Singleton <Character> .Instance.chaListCtrl.GetCategoryInfo(_ociChar.sex != 0?ChaListDefine.CategoryNo.custom_eye_f : ChaListDefine.CategoryNo.custom_eye_m).Keys.ToArray <int>(); _ociChar.charInfo.ChangeEyesPtn(!((IEnumerable <int>)array2).Contains <int>(charFileStatus.eyesPtn) ? 0 : charFileStatus.eyesPtn, true); _ociChar.ChangeBlink(charFileStatus.eyesBlink); _ociChar.ChangeEyesOpen(charFileStatus.eyesOpenMax); _ociChar.charInfo.ChangeMouthPtn(charFileStatus.mouthPtn, true); _ociChar.ChangeMouthOpen(_ociChar.oiCharInfo.mouthOpen); _ociChar.ChangeHandAnime(0, _ociChar.oiCharInfo.handPtn[0]); _ociChar.ChangeHandAnime(1, _ociChar.oiCharInfo.handPtn[1]); _ociChar.ChangeLookEyesPtn(charFileStatus.eyesLookPtn, true); if (_ociChar.oiCharInfo.eyesByteData != null) { using (MemoryStream memoryStream = new MemoryStream(_ociChar.oiCharInfo.eyesByteData)) { using (BinaryReader reader = new BinaryReader((Stream)memoryStream)) _ociChar.charInfo.eyeLookCtrl.eyeLookScript.LoadAngle(reader); } _ociChar.oiCharInfo.eyesByteData = (byte[])null; } if (_ociChar.oiCharInfo.neckByteData != null) { using (MemoryStream memoryStream = new MemoryStream(_ociChar.oiCharInfo.neckByteData)) { using (BinaryReader reader = new BinaryReader((Stream)memoryStream)) _ociChar.neckLookCtrl.LoadNeckLookCtrl(reader); } _ociChar.oiCharInfo.neckByteData = (byte[])null; } _ociChar.ChangeLookNeckPtn(charFileStatus.neckLookPtn); for (int index = 0; index < 5; ++index) { _ociChar.SetSiruFlags((ChaFileDefine.SiruParts)index, _ociChar.oiCharInfo.siru[index]); } if (_ociChar.sex == 1) { _ociChar.charInfo.ChangeHohoAkaRate(charFileStatus.hohoAkaRate); } _ociChar.SetVisibleSon(charFileStatus.visibleSonAlways); _ociChar.SetTears(_ociChar.GetTears()); _ociChar.SetTuyaRate(_ociChar.charInfo.skinGlossRate); _ociChar.SetWetRate(_ociChar.charInfo.wetRate); }
private void ExtendedSave_PoseBeingLoaded(string poseName, PauseCtrl.FileInfo fileInfo, OCIChar ociChar, ExtendedSave.GameNames gameName) { bool loadSkirtFK = false; PluginData data = ExtendedSave.GetPoseExtendedDataById(PoseToolsData); if (data != null) { bool sameGame = false; //Only load expression data for the game this pose was created on, eye etc. patterns wouldn't match otherwise #if KK || KKS if (gameName == ExtendedSave.GameNames.Koikatsu || gameName == ExtendedSave.GameNames.KoikatsuSunshine) { sameGame = true; } #elif AI || HS2 if (gameName == ExtendedSave.GameNames.AIGirl || gameName == ExtendedSave.GameNames.HoneySelect2) { sameGame = true; } #elif PH if (gameName == ExtendedSave.GameNames.PlayHome) { sameGame = true; } #endif //Facial expression if (sameGame && ConfigLoadExpression.Value) { #if !PH if (data.data.TryGetValue(EyebrowPatternData, out var eyebrowPatternData)) { ociChar.charInfo.ChangeEyebrowPtn((int)eyebrowPatternData); } #endif if (data.data.TryGetValue(EyesPatternData, out var eyesPatternData)) { ociChar.charInfo.ChangeEyesPtn((int)eyesPatternData); } if (data.data.TryGetValue(MouthPatternData, out var mouthPatternData)) { ociChar.charInfo.ChangeMouthPtn((int)mouthPatternData); } if (data.data.TryGetValue(EyeOpenData, out var eyeOpenData)) { ociChar.ChangeEyesOpen((float)eyeOpenData); } if (data.data.TryGetValue(MouthOpenData, out var mouthOpenData)) { ociChar.ChangeMouthOpen((float)mouthOpenData); } } //Skirt FK if (sameGame && ConfigLoadSkirtFK.Value && data.data.TryGetValue(SkirtFKData, out var skirtFKData) && skirtFKData != null) { loadSkirtFK = true; Dictionary <int, Vector3> skirtFK = MessagePackSerializer.Deserialize <Dictionary <int, Vector3> >((byte[])skirtFKData); foreach (KeyValuePair <int, Vector3> item in skirtFK) { ociChar.oiCharInfo.bones[item.Key].changeAmount.rot = item.Value; } } //Joint correction if (data.data.TryGetValue(JointCorrectionData, out var jointCorrectionData) && jointCorrectionData != null) { bool[] expression = MessagePackSerializer.Deserialize <bool[]>((byte[])jointCorrectionData); //Skip the first 4 since those are handled by vanilla code for (int i = 4; i < expression.Length; i++) { ociChar.EnableExpressionCategory(i, expression[i]); } } } if (!loadSkirtFK) { //Disable skirt FK if there was none to load since it's worthless to have enabled StartCoroutine(DisableSkirtFK(ociChar)); ociChar.ActiveFK(OIBoneInfo.BoneGroup.Skirt, false); } }