internal Dictionary <int, int> _ListClothesStates() { Dictionary <int, int> _clothesStates = new Dictionary <int, int>(); for (int i = 0; i < _clothesNames.Count; i++) { if (ChaControl.GetClothesStateKind(i) == null) { continue; } _clothesStates[i] = ChaControl.fileStatus.clothesState[i]; if (i == 0 && ChaControl.notBot && ChaControl.fileStatus.clothesState[1] == 3) { _clothesStates[i] = 3; } if (i == 1 && ChaControl.notBot && ChaControl.fileStatus.clothesState[0] == 3) { _clothesStates[i] = 3; } if (i == 2 && ChaControl.notShorts && ChaControl.fileStatus.clothesState[3] == 3) { _clothesStates[i] = 3; } if (i == 3 && ChaControl.notShorts && ChaControl.fileStatus.clothesState[2] == 3) { _clothesStates[i] = 3; } if (i == 7 && _shoesType != 0) { _clothesStates[i] = 3; } if (i == 8 && _shoesType != 1) { _clothesStates[i] = 3; } } if (_shoesType == 0 && ChaControl.GetClothesStateKind(7) == null) { _clothesStates[7] = 3; } if (_shoesType == 1 && ChaControl.GetClothesStateKind(8) == null) { _clothesStates[8] = 3; } return(_clothesStates); }
internal void MissingKindCheck(int _coordinate) { List <TriggerProperty> _list = TriggerPropertyList.Where(x => x.Coordinate == _coordinate && x.RefKind < 9).OrderBy(x => x.RefKind).ToList(); for (int i = 0; i <= 8; i++) { if (ChaControl.GetClothesStateKind(i) == null && _list.Where(x => x.RefKind == i).ToList().Count > 0) { RemoveKindTriggerProperty(_coordinate, i); _logger.LogMessage($"Triggers removed because no clothes assigned for {_clothesNames[i]}"); } } }
public static List <bool> GetClothesStates(ChaControl _chaCtrl, int _slotIndex) { List <bool> _states = new List <bool>(); Dictionary <byte, string> _keys = _chaCtrl.GetClothesStateKind(_slotIndex); if (_keys != null) { for (int i = 0; i < 4; i++) { _states.Add(_keys.ContainsKey((byte)i)); } } return(_states); }
internal void ToggleByRefKind(int _refKind) { if (_duringLoadChange) { return; } if (JetPack.CharaMaker.Loaded && !_cfgCharaMakerPreview.Value) { return; } if (JetPack.CharaStudio.Loaded && !TriggerEnabled) { return; } Dictionary <int, TriggerProperty> _effectingPropertList = new Dictionary <int, TriggerProperty>(); Dictionary <int, int> _clothesStates = _ListClothesStates(); HashSet <int> _filtered = new HashSet <int>(_cachedCoordinatePropertyList.Where(x => x.RefKind == _refKind).Select(x => x.Slot)); if (ChaControl.notBot && (_refKind == 0 || _refKind == 1)) { _filtered = new HashSet <int>(_cachedCoordinatePropertyList.Where(x => (x.RefKind == 0 || x.RefKind == 1)).Select(x => x.Slot)); } if (ChaControl.notShorts && (_refKind == 2 || _refKind == 3)) { _filtered = new HashSet <int>(_cachedCoordinatePropertyList.Where(x => (x.RefKind == 2 || x.RefKind == 3)).Select(x => x.Slot)); } if (_refKind == 7 || _refKind == 8) { _filtered = new HashSet <int>(_cachedCoordinatePropertyList.Where(x => (x.RefKind == 7 || x.RefKind == 8)).Select(x => x.Slot)); } foreach (int _slot in _filtered) { TriggerProperty _effectingPropert = null; List <TriggerProperty> _slotPropertyList = _cachedCoordinatePropertyList.Where(x => x.Slot == _slot).OrderByDescending(x => x.Priority).ThenBy(x => x.RefKind).ThenBy(x => x.RefState).ToList(); foreach (TriggerProperty x in _slotPropertyList) { DebugMsg(LogLevel.Info, $"[ToggleByRefKind][Slot: {x.Slot}][Priority: {x.Priority}][RefKind: {x.RefKind}][RefState: {x.RefState}][Visible: {x.Visible}]"); if (MathfEx.RangeEqualOn(0, x.RefKind, 8)) { if (!_clothesStates.ContainsKey(x.RefKind)) { continue; } if (_shoesType == 0 && x.RefKind == 8 && ChaControl.GetClothesStateKind(7) != null) { continue; } if (_shoesType == 1 && x.RefKind == 7 && ChaControl.GetClothesStateKind(8) != null) { continue; } if (_clothesStates[x.RefKind] == x.RefState) { _effectingPropert = x; break; } } else if (x.RefKind >= 9) { TriggerGroup _group = _cachedCoordinateGroupList.Where(y => y.Kind == x.RefKind).FirstOrDefault(); if (_group != null && _group.State == x.RefState) { _effectingPropert = x; break; } } } if (_effectingPropert != null) { _effectingPropertList[_slot] = _effectingPropert; } } foreach (TriggerProperty _trigger in _effectingPropertList.Values) { ChaControl.SetAccessoryState(_trigger.Slot, _trigger.Visible); } }