internal static void SetColors(ChaFileControl chaFile) { // Get list of outfits to change var outfitsToChange = Outfits.GetOutfitsToChange(); // Apply colors to outfits foreach (var outfit in outfitsToChange) { var currParts = chaFile.coordinate[outfit].clothes.parts; Outfits.Keys key; int clothesindex; if (outfit == Outfits.School || outfit == Outfits.GoingHome) { key = Outfits.Keys.MainTop; clothesindex = Clothes.Top; } else if (outfit == Outfits.PE) { key = Outfits.Keys.PETop; clothesindex = Clothes.Top; } else { key = Outfits.Keys.SwimsuitTop; clothesindex = Clothes.Bra; } for (var j = 0; j < 4; j++) { if (TopFlag) { currParts[clothesindex].colorInfo[j].baseColor = Palette[key][j]; currParts[clothesindex].colorInfo[j].patternColor = Palette[key][j + 4]; } if (BottomFlag) { currParts[clothesindex + 1].colorInfo[j].baseColor = Palette[key + 1][j]; currParts[clothesindex + 1].colorInfo[j].patternColor = Palette[key + 1][j + 4]; } } } }
internal static void LoadColorsFromCharacter() { if (CurrClassData.data == null) { return; } ChaFileControl chaFile = CurrClassData.data.charFile; // Load strict uniforms if character is wearing uniform if (chaFile.coordinate[0].clothes.parts[0].id == 1 || chaFile.coordinate[0].clothes.parts[0].id == 2) { Clothes.StrictUniform = chaFile.coordinate[0].clothes.parts[0].id; Logger.Log(BepInEx.Logging.LogLevel.Message, String.Format("Setting uniform to apply to {0}.", Clothes.StrictUniform == 2 ? "Blazer" : "Sailor")); } else { Logger.Log(BepInEx.Logging.LogLevel.Message, "Current card is not wearing regulation uniform, setting uniform to Sailor/Blazer."); Clothes.StrictUniform = 0; } // Get list of outfits to change List <int> outfitsToChange = Outfits.GetOutfitsToChange(); // Load colors from outfits foreach (int outfit in outfitsToChange) { ChaFileClothes.PartsInfo[] currParts = chaFile.coordinate[outfit].clothes.parts; for (int i = 0; i < 4; i++) { Outfits.Keys key; int clothesindex; if (outfit == Outfits.School || outfit == Outfits.GoingHome) { key = Outfits.Keys.MainTop; clothesindex = Clothes.Top; } else if (outfit == Outfits.PE) { key = Outfits.Keys.PETop; clothesindex = Clothes.Top; } else { key = Outfits.Keys.SwimsuitTop; clothesindex = Clothes.Bra; } if (Colors.TopFlag) { Colors.Palette[key][i] = currParts[clothesindex].colorInfo[i].baseColor; Colors.Palette[key][i + 4] = currParts[clothesindex].colorInfo[i].patternColor; } if (Colors.BottomFlag) { Colors.Palette[key + 1][i] = currParts[clothesindex + 1].colorInfo[i].baseColor; Colors.Palette[key + 1][i + 4] = currParts[clothesindex + 1].colorInfo[i].baseColor; } } } Utils.Sound.Play(SystemSE.sel); }
private static void SetRandomClothes(ChaFileControl chaFile) { // Get list of outfits to change List <int> outfitsToChange = Outfits.GetOutfitsToChange(); // Apply clothes to outfits foreach (int outfit in outfitsToChange) { ChaFileClothes.PartsInfo[] currParts = chaFile.coordinate[outfit].clothes.parts; int[] currSubParts = chaFile.coordinate[outfit].clothes.subPartsId; bool topChanged = false; currParts[Clothes.Top].emblemeId = Outfits.EmblemFlag ? Outfits.EmblemID : currParts[Clothes.Top].emblemeId; List <int> tops; List <int> bottoms; if (outfit == Outfits.School || outfit == Outfits.GoingHome) { tops = Default.Top; bottoms = Default.Bottom; } else if (outfit == Outfits.PE) { tops = Default.PETop; bottoms = Default.PEBottom; } else { tops = Default.SwimsuitTop; bottoms = Default.SwimsuitBottom; } // Change Tops if (Clothes.StrictUniform == 0) { if (Clothes.TopFlag && !tops.Contains(currParts[Clothes.Top].id)) { currParts[Clothes.Top].id = tops[Utilities.Rand.Next(tops.Count)]; topChanged = true; } } else { currParts[Clothes.Top].id = Clothes.StrictUniform; topChanged = true; } // Change Bottoms if (Clothes.BottomFlag && !bottoms.Contains(currParts[Clothes.Bottom].id)) { currParts[Clothes.Bottom].id = bottoms[Utilities.Rand.Next(bottoms.Count)]; } // Change Swimsuit if (outfit == Outfits.Swimsuit) { currParts[Clothes.Bra].id = Default.SwimsuitBras[Utilities.Rand.Next(Default.SwimsuitBras.Count)]; } List <int> subunder; List <int> subover; List <int> subdeco; // Set random subparts if (outfit == Outfits.School || outfit == Outfits.GoingHome) { if (currParts[Clothes.Top].id == 2) { subunder = Default.SubBlazerUnder; subover = Default.SubBlazerOver; subdeco = Default.SubBlazerdeco; } else { subunder = Default.SubSailorUnder; subover = Default.SubSailorOver; subdeco = Default.SubSailorDeco; } } else if (outfit == Outfits.PE) { subunder = Default.SubPEUnder; subover = Default.SubPEOver; subdeco = Default.SubPEDeco; } else { subunder = Default.SubSwimsuitUnder; subover = Default.SubSwimsuitOver; subdeco = Default.SubSwimsuitDeco; } if (topChanged) { currSubParts[Clothes.Subshirt] = subunder[Utilities.Rand.Next(subunder.Count)]; currSubParts[Clothes.Subjacketcollar] = subover[Utilities.Rand.Next(subover.Count)]; currSubParts[Clothes.Subdecoration] = subdeco[Utilities.Rand.Next(subdeco.Count)]; } } // Set Colors Colors.SetColors(chaFile); }