public static string GetCurrentFrameInfo(DenUtil.RaidData raidInfo, uint flawlessIVs, ulong seed, out uint shinyType, bool raid = true) { var rng = new Xoroshiro128Plus(seed); _ = (uint)rng.NextInt(0xFFFFFFFF); uint SIDTID = (uint)rng.NextInt(0xFFFFFFFF); uint PID = (uint)rng.NextInt(0xFFFFFFFF); shinyType = GetShinyType(PID, SIDTID); var IVs = new uint[] { 255, 255, 255, 255, 255, 255 }; GetIVs(rng, IVs, flawlessIVs, out uint[,] allIVs, out _); uint[] ivs = new uint[6]; for (int i = 0; i < 6; i++) { ivs[i] = allIVs[flawlessIVs - 1, i]; } return(DenUtil.IVSpreadByStar(GetIVSpread(allIVs), raidInfo, ivs, seed, raid)); }
public static void SpecificSeedSearch(DenUtil.RaidData raidInfo, out long frames, out ulong seedRes, out ulong threeDay, out string ivSpread) { threeDay = seedRes = 0; frames = 0; ivSpread = string.Empty; ulong seed = raidInfo.Den.Seed; var rng = new Xoroshiro128Plus(seed); for (long i = 0; i < raidInfo.SearchRange; i++) { if (i > 0) { rng = new Xoroshiro128Plus(seed); seed = rng.Next(); rng = new Xoroshiro128Plus(seed); } uint EC = (uint)rng.NextInt(0xFFFFFFFF); uint SIDTID = (uint)rng.NextInt(0xFFFFFFFF); uint PID = (uint)rng.NextInt(0xFFFFFFFF); uint shinytype = GetShinyType(PID, SIDTID); if (shinytype == (uint)raidInfo.Shiny) { rng = GetIVs(rng, raidInfo.IVs, raidInfo.GuaranteedIVs, out uint[,] allIVs, out bool IVMatch); if (!IVMatch) { continue; } GetCharacteristic(EC, allIVs, raidInfo.GuaranteedIVs - 1, out bool charMatch, raidInfo.Characteristic); if (!charMatch) { continue; } rng = GetAbility(rng, raidInfo.Den.IsEvent ? raidInfo.RaidDistributionEncounter.Ability : (uint)raidInfo.RaidEncounter.Ability, out uint abilityT); bool abilityMatch = raidInfo.Ability == AbilityType.Any ? abilityT != (uint)raidInfo.Ability : abilityT == (uint)raidInfo.Ability; if (!abilityMatch) { continue; } rng = GetGender(rng, raidInfo.Ratio, raidInfo.Den.IsEvent ? raidInfo.RaidDistributionEncounter.Gender : (uint)raidInfo.RaidEncounter.Gender, out uint genderT); bool genderMatch = raidInfo.Gender == GenderType.Any ? genderT != (uint)raidInfo.Gender : genderT == (uint)raidInfo.Gender; if (!genderMatch) { continue; } GetNature(rng, raidInfo.Den.IsEvent ? raidInfo.RaidDistributionEncounter.Species : raidInfo.RaidEncounter.Species, raidInfo.Den.IsEvent ? raidInfo.RaidDistributionEncounter.AltForm : raidInfo.RaidEncounter.AltForm, out uint natureT); bool natureMatch = raidInfo.Nature == Nature.Random ? natureT != (uint)raidInfo.Nature : natureT == (uint)raidInfo.Nature; if (!natureMatch) { continue; } ivSpread = DenUtil.IVSpreadByStar(GetIVSpread(allIVs), raidInfo, seed); frames = i; seedRes = seed; for (int d = 3; d > 0; d--) { seed -= 0x82A2B175229D6A5B; } threeDay = seed; return; } if (i >= raidInfo.SearchRange) { return; } } }