private void GetEntry() { // Load Bools for the data int bit = species - 1; byte mask = (byte)(1 << (bit & 7)); int ofs = SAV.PokeDex + (bit >> 3) + 0x4; int FormOffset1 = SAV.PokeDex + 4 + (brSize * 4) + 4; int PokeDexLanguageFlags = FormOffset1 + (SAV.HGSS ? 0x3C : 0x20); int l_ofs = !SAV.DP ? species : 1 + Array.IndexOf(DPLangSpecies, species); if (l_ofs > 0) { l_ofs += PokeDexLanguageFlags; for (int i = 0; i < LangCount; i++) { CL[i].Enabled = true; CL[i].Checked = SAV.GetFlag(l_ofs, i); } } else { for (int i = 0; i < LangCount; i++) { CL[i].Enabled = CL[i].Checked = false; } } bool bit2 = (SAV.General[ofs + (brSize * 2)] & mask) != 0; bool bit3 = (SAV.General[ofs + (brSize * 3)] & mask) != 0; CHK_Seen.Checked = (SAV.General[ofs + (brSize * 1)] & mask) != 0; CHK_Caught.Checked = (SAV.General[ofs + (brSize * 0)] & mask) != 0; // Genders LB_Gender.Items.Clear(); LB_NGender.Items.Clear(); var active = CHK_Seen.Checked ? LB_Gender : LB_NGender; var inactive = LB_NGender; var other = bit2 ^ bit3 ? active : inactive; switch (SAV.Personal[species].Gender) { case 255: // Genderless active.Items.Add(GENDERLESS); break; case 0: active.Items.Add(MALE); break; case 254: active.Items.Add(FEMALE); break; default: active.Items.Add(bit2 ? FEMALE : MALE); other.Items.Add(bit2 ? MALE : FEMALE); break; } // Forms LB_Form.Items.Clear(); LB_NForm.Items.Clear(); var forms = SAV.GetForms(species); if (forms.Length == 0) { return; } string[] formNames = GetFormNames4Dex(species); var seen = forms.Where(z => z >= 0 && z < forms.Length).Distinct().Select((_, i) => formNames[forms[i]]).ToArray(); var not = formNames.Where(z => !seen.Contains(z)).ToArray(); LB_Form.Items.AddRange(seen); LB_NForm.Items.AddRange(not); }
private void GetEntry() { // Load Bools for the data int bit = species - 1; byte mask = (byte)(1 << (bit & 7)); int ofs = SAV.PokeDex + (bit >> 3) + 0x4; int FormOffset1 = SAV.PokeDex + 4 + brSize * 4 + 4; int PokeDexLanguageFlags = FormOffset1 + (SAV.HGSS ? 0x3C : 0x20); int l_ofs = !SAV.DP ? species : 1 + Array.IndexOf(DPLangSpecies, species); if (l_ofs > 0) { l_ofs += PokeDexLanguageFlags; for (int i = 0; i < LangCount; i++) { CL[i].Enabled = true; CL[i].Checked = (SAV.Data[l_ofs] & (byte)(1 << i)) != 0; } } else { for (int i = 0; i < LangCount; i++) { CL[i].Enabled = CL[i].Checked = false; } } bool bit2 = (SAV.Data[ofs + brSize * 2] & mask) != 0; bool bit3 = (SAV.Data[ofs + brSize * 3] & mask) != 0; CHK_Seen.Checked = (SAV.Data[ofs + brSize * 1] & mask) != 0; CHK_Caught.Checked = (SAV.Data[ofs + brSize * 0] & mask) != 0; // Genders LB_Gender.Items.Clear(); LB_NGender.Items.Clear(); var active = CHK_Seen.Checked ? LB_Gender : LB_NGender; var inactive = LB_NGender; var other = bit2 ^ bit3 ? active : inactive; switch (SAV.Personal[species].Gender) { case 255: // Genderless active.Items.Add(GENDERLESS); break; case 0: active.Items.Add(MALE); break; case 254: active.Items.Add(FEMALE); break; default: active.Items.Add(bit2 ? FEMALE : MALE); other.Items.Add(bit2 ? MALE : FEMALE); break; } // Forms LB_Form.Items.Clear(); LB_NForm.Items.Clear(); var forms = SAV.GetForms(species); if (forms == null) { return; } string[] formNames = PKX.GetFormList(species, GameInfo.Strings.types, GameInfo.Strings.forms, Main.GenderSymbols, 4); var seen = forms.Where(z => (byte)z != 0xFF).Select((v, i) => formNames[forms[i]]).ToArray(); var not = formNames.Where(z => !seen.Contains(z)).ToArray(); LB_Form.Items.AddRange(seen); LB_NForm.Items.AddRange(not); }