mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-26 14:00:21 +00:00
Misc variable name changes
readability++
This commit is contained in:
parent
ddd1a36fa6
commit
59b41937e1
23 changed files with 111 additions and 113 deletions
|
@ -31,12 +31,12 @@ namespace PKHeX.Core
|
|||
return false;
|
||||
}
|
||||
|
||||
var r = BatchEditing.TryModifyPKM(pkm, filters, modifications);
|
||||
if (r != ModifyResult.Invalid)
|
||||
var result = BatchEditing.TryModifyPKM(pkm, filters, modifications);
|
||||
if (result != ModifyResult.Invalid)
|
||||
Iterated++;
|
||||
if (r == ModifyResult.Error)
|
||||
if (result == ModifyResult.Error)
|
||||
Errored++;
|
||||
if (r != ModifyResult.Modified)
|
||||
if (result != ModifyResult.Modified)
|
||||
return false;
|
||||
|
||||
pkm.RefreshChecksum();
|
||||
|
|
|
@ -136,7 +136,7 @@ namespace PKHeX.Core
|
|||
var metSanitize = (string[])cxd.Clone();
|
||||
for (int i = 0; i < metSanitize.Length; i++)
|
||||
{
|
||||
if (cxd.Count(r => r == metSanitize[i]) > 1)
|
||||
if (cxd.Count(z => z == metSanitize[i]) > 1)
|
||||
metSanitize[i] += $" [{i:000}]";
|
||||
}
|
||||
|
||||
|
|
|
@ -113,17 +113,17 @@ namespace PKHeX.Core
|
|||
/// <summary>
|
||||
/// Gets Country and Region strings for corresponding IDs and language.
|
||||
/// </summary>
|
||||
/// <param name="country">Country ID</param>
|
||||
/// <param name="region">Region ID</param>
|
||||
/// <param name="countryID">Country ID</param>
|
||||
/// <param name="regionID">Region ID</param>
|
||||
/// <param name="language">Language ID</param>
|
||||
/// <returns></returns>
|
||||
public static Tuple<string, string> GetCountryRegionText(int country, int region, string language)
|
||||
/// <returns>Tuple containing country and region</returns>
|
||||
public static Tuple<string, string> GetCountryRegionText(int countryID, int regionID, string language)
|
||||
{
|
||||
// Get Language we're fetching for
|
||||
int lang = Array.IndexOf(lang_geo, language);
|
||||
string c = GetCountryName(country, lang);
|
||||
string r = GetRegionName(country, region, lang);
|
||||
return new Tuple<string, string>(c, r); // country, region
|
||||
var country = GetCountryName(countryID, lang);
|
||||
var region = GetRegionName(countryID, regionID, lang);
|
||||
return new Tuple<string, string>(country, region); // country, region
|
||||
}
|
||||
|
||||
private static int GetLanguageIndex(string language) => Array.IndexOf(lang_geo, language);
|
||||
|
|
|
@ -234,7 +234,7 @@ namespace PKHeX.Core
|
|||
private static CheckMoveResult[] ParseMoves(PKM pkm, MoveParseSource source, LegalInfo info)
|
||||
{
|
||||
CheckMoveResult[] res = new CheckMoveResult[4];
|
||||
bool AllParsed() => res.All(r => r != null);
|
||||
bool AllParsed() => res.All(z => z != null);
|
||||
var required = pkm.Format != 1 ? 1 : GBRestrictions.GetRequiredMoveCount(pkm, source.CurrentMoves, info, source.Base);
|
||||
|
||||
// Check empty moves and relearn moves before generation specific moves
|
||||
|
|
|
@ -59,19 +59,19 @@ namespace PKHeX
|
|||
|
||||
private static int[] GetMinLevelLearnMoveG1(int species, List<int> moves)
|
||||
{
|
||||
var r = new int[moves.Count];
|
||||
for (int i = 0; i < r.Length; i++)
|
||||
r[i] = MoveLevelUp.GetIsLevelUp1(species, moves[i], 100, 0, 0).Level;
|
||||
return r;
|
||||
var result = new int[moves.Count];
|
||||
for (int i = 0; i < result.Length; i++)
|
||||
result[i] = MoveLevelUp.GetIsLevelUp1(species, moves[i], 100, 0, 0).Level;
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int[] GetMaxLevelLearnMoveG1(int species, List<int> moves)
|
||||
{
|
||||
var r = new int[moves.Count];
|
||||
var result = new int[moves.Count];
|
||||
|
||||
int index = PersonalTable.RB.GetFormeIndex(species, 0);
|
||||
if (index == 0)
|
||||
return r;
|
||||
return result;
|
||||
|
||||
var pi_rb = ((PersonalInfoG1)PersonalTable.RB[index]).Moves;
|
||||
var pi_y = ((PersonalInfoG1)PersonalTable.Y[index]).Moves;
|
||||
|
@ -79,10 +79,10 @@ namespace PKHeX
|
|||
for (int m = 0; m < moves.Count; m++)
|
||||
{
|
||||
bool start = pi_rb.Contains(moves[m]) && pi_y.Contains(moves[m]);
|
||||
r[m] = start ? 1 : Math.Max(GetHighest(LevelUpRB), GetHighest(LevelUpY));
|
||||
result[m] = start ? 1 : Math.Max(GetHighest(LevelUpRB), GetHighest(LevelUpY));
|
||||
int GetHighest(IReadOnlyList<Learnset> learn) => learn[index].GetLevelLearnMove(moves[m]);
|
||||
}
|
||||
return r;
|
||||
return result;
|
||||
}
|
||||
|
||||
private static List<int>[] GetExclusiveMovesG1(int species1, int species2, IEnumerable<int> tmhm, IEnumerable<int> moves)
|
||||
|
|
|
@ -393,7 +393,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
int IVCount = ivflag - 0xFB;
|
||||
do { finalIVs[Util.Rand.Next(6)] = 31; }
|
||||
while (finalIVs.Count(r => r == 31) < IVCount);
|
||||
while (finalIVs.Count(iv => iv == 31) < IVCount);
|
||||
for (int i = 0; i < 6; i++)
|
||||
finalIVs[i] = finalIVs[i] == 31 ? pk.MaxIV : Util.Rand.Next(pk.MaxIV + 1);
|
||||
}
|
||||
|
|
|
@ -400,7 +400,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
int IVCount = ivflag - 0xFB;
|
||||
do { finalIVs[Util.Rand.Next(6)] = 31; }
|
||||
while (finalIVs.Count(r => r == 31) < IVCount);
|
||||
while (finalIVs.Count(iv => iv == 31) < IVCount);
|
||||
for (int i = 0; i < 6; i++)
|
||||
finalIVs[i] = finalIVs[i] == 31 ? pk.MaxIV : Util.Rand.Next(pk.MaxIV + 1);
|
||||
}
|
||||
|
|
|
@ -431,7 +431,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
int IVCount = ivflag - 0xFB;
|
||||
do { finalIVs[Util.Rand.Next(6)] = 31; }
|
||||
while (finalIVs.Count(r => r == 31) < IVCount);
|
||||
while (finalIVs.Count(iv => iv == 31) < IVCount);
|
||||
for (int i = 0; i < 6; i++)
|
||||
finalIVs[i] = finalIVs[i] == 31 ? pk.MaxIV : Util.Rand.Next(pk.MaxIV + 1);
|
||||
}
|
||||
|
|
|
@ -242,10 +242,10 @@ namespace PKHeX.Core
|
|||
{
|
||||
if (length < 0)
|
||||
length = data.Length;
|
||||
bool[] r = new bool[length << 3];
|
||||
for (int i = 0; i < r.Length; i++)
|
||||
r[i] = (data[start + (i >> 3)] >> (i & 7) & 0x1) == 1;
|
||||
return r;
|
||||
bool[] result = new bool[length << 3];
|
||||
for (int i = 0; i < result.Length; i++)
|
||||
result[i] = (data[start + (i >> 3)] >> (i & 7) & 0x1) == 1;
|
||||
return result;
|
||||
}
|
||||
|
||||
protected static byte[] SetBits(bool[] bits)
|
||||
|
|
|
@ -109,13 +109,13 @@ namespace PKHeX.Core
|
|||
|
||||
private static byte[][] SplitBytes(byte[] data, int size)
|
||||
{
|
||||
byte[][] r = new byte[data.Length / size][];
|
||||
byte[][] result = new byte[data.Length / size][];
|
||||
for (int i = 0; i < data.Length; i += size)
|
||||
{
|
||||
r[i / size] = new byte[size];
|
||||
Array.Copy(data, i, r[i / size], 0, size);
|
||||
result[i / size] = new byte[size];
|
||||
Array.Copy(data, i, result[i / size], 0, size);
|
||||
}
|
||||
return r;
|
||||
return result;
|
||||
}
|
||||
|
||||
private static Func<byte[], PersonalInfo> GetConstructor(GameVersion format)
|
||||
|
|
|
@ -778,10 +778,10 @@ namespace PKHeX.Core
|
|||
if (WondercardData < 0 || WondercardFlags < 0)
|
||||
return Array.Empty<bool>();
|
||||
|
||||
bool[] r = new bool[GiftFlagMax];
|
||||
for (int i = 0; i < r.Length; i++)
|
||||
r[i] = (Data[WondercardFlags + (i >> 3)] >> (i & 7) & 0x1) == 1;
|
||||
return r;
|
||||
bool[] result = new bool[GiftFlagMax];
|
||||
for (int i = 0; i < result.Length; i++)
|
||||
result[i] = (Data[WondercardFlags + (i >> 3)] >> (i & 7) & 0x1) == 1;
|
||||
return result;
|
||||
}
|
||||
set
|
||||
{
|
||||
|
|
|
@ -977,10 +977,10 @@ namespace PKHeX.Core
|
|||
if (WondercardData < 0 || WondercardFlags < 0)
|
||||
return Array.Empty<bool>();
|
||||
|
||||
bool[] r = new bool[(WondercardData - WondercardFlags) * 8];
|
||||
for (int i = 0; i < r.Length; i++)
|
||||
r[i] = (Data[WondercardFlags + (i >> 3)] >> (i & 7) & 0x1) == 1;
|
||||
return r;
|
||||
bool[] result = new bool[(WondercardData - WondercardFlags) * 8];
|
||||
for (int i = 0; i < result.Length; i++)
|
||||
result[i] = (Data[WondercardFlags + (i >> 3)] >> (i & 7) & 0x1) == 1;
|
||||
return result;
|
||||
}
|
||||
set
|
||||
{
|
||||
|
@ -1104,27 +1104,27 @@ namespace PKHeX.Core
|
|||
// Writeback Validity
|
||||
public override string MiscSaveChecks()
|
||||
{
|
||||
var r = new StringBuilder();
|
||||
var sb = new StringBuilder();
|
||||
|
||||
// FFFF checks
|
||||
for (int i = 0; i < Data.Length / 0x200; i++)
|
||||
{
|
||||
if (Data.Skip(i * 0x200).Take(0x200).Any(z => z != 0xFF))
|
||||
continue;
|
||||
r.Append("0x200 chunk @ 0x").AppendFormat("{0:X5}", i * 0x200).AppendLine(" is FF'd.");
|
||||
r.AppendLine("Cyber will screw up (as of August 31st 2014).");
|
||||
r.AppendLine();
|
||||
sb.Append("0x200 chunk @ 0x").AppendFormat("{0:X5}", i * 0x200).AppendLine(" is FF'd.");
|
||||
sb.AppendLine("Cyber will screw up (as of August 31st 2014).");
|
||||
sb.AppendLine();
|
||||
|
||||
// Check to see if it is in the Pokedex
|
||||
if (i * 0x200 > PokeDex && i * 0x200 < PokeDex + 0x900)
|
||||
{
|
||||
r.Append("Problem lies in the Pokedex. ");
|
||||
sb.Append("Problem lies in the Pokedex. ");
|
||||
if (i * 0x200 == PokeDex + 0x400)
|
||||
r.Append("Remove a language flag for a species < 585, ie Petilil");
|
||||
sb.Append("Remove a language flag for a species < 585, ie Petilil");
|
||||
}
|
||||
break;
|
||||
}
|
||||
return r.ToString();
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public override string MiscSaveInfo() => string.Join(Environment.NewLine, Blocks.Select(b => b.Summary));
|
||||
|
|
|
@ -1413,10 +1413,10 @@ namespace PKHeX.Core
|
|||
if (WondercardData < 0 || WondercardFlags < 0)
|
||||
return Array.Empty<bool>();
|
||||
|
||||
bool[] r = new bool[(WondercardData-WondercardFlags)*8];
|
||||
for (int i = 0; i < r.Length; i++)
|
||||
r[i] = (Data[WondercardFlags + (i>>3)] >> (i&7) & 0x1) == 1;
|
||||
return r;
|
||||
bool[] result = new bool[(WondercardData-WondercardFlags)*8];
|
||||
for (int i = 0; i < result.Length; i++)
|
||||
result[i] = (Data[WondercardFlags + (i>>3)] >> (i&7) & 0x1) == 1;
|
||||
return result;
|
||||
}
|
||||
set
|
||||
{
|
||||
|
@ -1488,27 +1488,27 @@ namespace PKHeX.Core
|
|||
// Writeback Validity
|
||||
public override string MiscSaveChecks()
|
||||
{
|
||||
var r = new StringBuilder();
|
||||
var sb = new StringBuilder();
|
||||
|
||||
// FFFF checks
|
||||
for (int i = 0; i < Data.Length / 0x200; i++)
|
||||
{
|
||||
if (Data.Skip(i * 0x200).Take(0x200).Any(z => z != 0xFF))
|
||||
continue;
|
||||
r.Append("0x200 chunk @ 0x").AppendFormat("{0:X5}", i * 0x200).AppendLine(" is FF'd.");
|
||||
r.AppendLine("Cyber will screw up (as of August 31st 2014).");
|
||||
r.AppendLine();
|
||||
sb.Append("0x200 chunk @ 0x").AppendFormat("{0:X5}", i * 0x200).AppendLine(" is FF'd.");
|
||||
sb.AppendLine("Cyber will screw up (as of August 31st 2014).");
|
||||
sb.AppendLine();
|
||||
|
||||
// Check to see if it is in the Pokedex
|
||||
if (i * 0x200 > PokeDex && i * 0x200 < PokeDex + 0x900)
|
||||
{
|
||||
r.Append("Problem lies in the Pokedex. ");
|
||||
sb.Append("Problem lies in the Pokedex. ");
|
||||
if (i * 0x200 == PokeDex + 0x400)
|
||||
r.Append("Remove a language flag for a species < 585, ie Petilil");
|
||||
sb.Append("Remove a language flag for a species < 585, ie Petilil");
|
||||
}
|
||||
break;
|
||||
}
|
||||
return r.ToString();
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public override string MiscSaveInfo() => string.Join(Environment.NewLine, Blocks.Select(b => b.Summary));
|
||||
|
|
|
@ -22,9 +22,9 @@ namespace PKHeX.Core
|
|||
int n = items.Count;
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
int r = i + Rand.Next(n-i);
|
||||
T t = items[r];
|
||||
items[r] = items[i];
|
||||
int index = i + Rand.Next(n-i);
|
||||
T t = items[index];
|
||||
items[index] = items[i];
|
||||
items[i] = t;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -742,8 +742,8 @@ namespace PKHeX.WinForms.Controls
|
|||
if (!silent)
|
||||
{
|
||||
var movestrings = m.Select(v => v >= GameInfo.Strings.Move.Count ? MsgProgramError : GameInfo.Strings.Move[v]);
|
||||
string r = string.Join(Environment.NewLine, movestrings);
|
||||
if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, MsgPKMSuggestionMoves, r))
|
||||
var msg = string.Join(Environment.NewLine, movestrings);
|
||||
if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, MsgPKMSuggestionMoves, msg))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -758,23 +758,21 @@ namespace PKHeX.WinForms.Controls
|
|||
{
|
||||
if (pkm.Format < 6)
|
||||
return false;
|
||||
int[] m = pkm.GetSuggestedRelearnMoves(Legality);
|
||||
|
||||
var m = pkm.GetSuggestedRelearnMoves(Legality);
|
||||
if (pkm.RelearnMoves.SequenceEqual(m))
|
||||
return false;
|
||||
|
||||
if (!silent)
|
||||
{
|
||||
var movestrings = m.Select(v => v >= GameInfo.Strings.Move.Count ? MsgProgramError : GameInfo.Strings.Move[v]);
|
||||
string r = string.Join(Environment.NewLine, movestrings);
|
||||
if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, MsgPKMSuggestionRelearn, r))
|
||||
var msg = string.Join(Environment.NewLine, movestrings);
|
||||
if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, MsgPKMSuggestionRelearn, msg))
|
||||
return false;
|
||||
}
|
||||
|
||||
CB_RelearnMove1.SelectedValue = m[0];
|
||||
CB_RelearnMove2.SelectedValue = m[1];
|
||||
CB_RelearnMove3.SelectedValue = m[2];
|
||||
CB_RelearnMove4.SelectedValue = m[3];
|
||||
pkm.RelearnMoves = m;
|
||||
LoadRelearnMoves(pkm);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -801,12 +799,12 @@ namespace PKHeX.WinForms.Controls
|
|||
|
||||
if (!silent)
|
||||
{
|
||||
List<string> suggestion = GetSuggestionMessage(pkm, level, location, minlvl);
|
||||
if (suggestion.Count == 1) // no suggestion
|
||||
var suggestions = GetSuggestionMessage(pkm, level, location, minlvl);
|
||||
if (suggestions.Count <= 1) // no suggestion
|
||||
return false;
|
||||
|
||||
string suggest = string.Join(Environment.NewLine, suggestion);
|
||||
if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, suggest) != DialogResult.Yes)
|
||||
var msg = string.Join(Environment.NewLine, suggestions);
|
||||
if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, msg) != DialogResult.Yes)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,25 +13,25 @@ namespace PKHeX.WinForms
|
|||
InitializeComponent();
|
||||
WinFormsUtil.TranslateInterface(this, Main.CurrentLanguage);
|
||||
pkm = pk;
|
||||
cba = new[] { CB_Country0, CB_Country1, CB_Country2, CB_Country3, CB_Country4 };
|
||||
mta = new[] { CB_Region0, CB_Region1, CB_Region2, CB_Region3, CB_Region4, };
|
||||
PrevCountries = new[] { CB_Country0, CB_Country1, CB_Country2, CB_Country3, CB_Country4 };
|
||||
PrevRegions = new[] { CB_Region0, CB_Region1, CB_Region2, CB_Region3, CB_Region4, };
|
||||
string[] arguments = L_Arguments.Text.Split(new[] {" ; "}, StringSplitOptions.None);
|
||||
|
||||
TextArgs = new TextMarkup(arguments);
|
||||
foreach (ComboBox comboBox in cba)
|
||||
foreach (ComboBox comboBox in PrevCountries)
|
||||
{
|
||||
comboBox.InitializeBinding();
|
||||
Main.SetCountrySubRegion(comboBox, "countries");
|
||||
}
|
||||
foreach (var r in mta)
|
||||
r.InitializeBinding();
|
||||
foreach (var region in PrevRegions)
|
||||
region.InitializeBinding();
|
||||
GetLangStrings();
|
||||
LoadFields();
|
||||
}
|
||||
|
||||
private bool init;
|
||||
private readonly ComboBox[] cba;
|
||||
private readonly ComboBox[] mta;
|
||||
private readonly ComboBox[] PrevCountries;
|
||||
private readonly ComboBox[] PrevRegions;
|
||||
private readonly PKM pkm;
|
||||
|
||||
// Load/Save Actions
|
||||
|
@ -267,18 +267,18 @@ namespace PKHeX.WinForms
|
|||
|
||||
private void ChangeCountryIndex(object sender, EventArgs e)
|
||||
{
|
||||
int index = Array.IndexOf(cba, sender);
|
||||
int index = Array.IndexOf(PrevCountries, sender);
|
||||
int val;
|
||||
if (sender is ComboBox c && (val = WinFormsUtil.GetIndex(c)) > 0)
|
||||
{
|
||||
Main.SetCountrySubRegion(mta[index], $"sr_{val:000}");
|
||||
mta[index].Enabled = true;
|
||||
Main.SetCountrySubRegion(PrevRegions[index], $"sr_{val:000}");
|
||||
PrevRegions[index].Enabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
mta[index].DataSource = new[] { new { Text = "", Value = 0 } };
|
||||
mta[index].Enabled = false;
|
||||
mta[index].SelectedValue = 0;
|
||||
PrevRegions[index].DataSource = new[] { new { Text = "", Value = 0 } };
|
||||
PrevRegions[index].Enabled = false;
|
||||
PrevRegions[index].SelectedValue = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -301,17 +301,17 @@ namespace PKHeX.WinForms
|
|||
{
|
||||
Label[] senderarr = { L_Geo0, L_Geo1, L_Geo2, L_Geo3, L_Geo4, };
|
||||
int index = Array.IndexOf(senderarr, sender);
|
||||
cba[index].SelectedValue = 0;
|
||||
PrevCountries[index].SelectedValue = 0;
|
||||
|
||||
mta[index].InitializeBinding();
|
||||
mta[index].DataSource = new[] { new { Text = "", Value = 0 } };
|
||||
mta[index].SelectedValue = 0;
|
||||
PrevRegions[index].InitializeBinding();
|
||||
PrevRegions[index].DataSource = new[] { new { Text = "", Value = 0 } };
|
||||
PrevRegions[index].SelectedValue = 0;
|
||||
}
|
||||
|
||||
private void B_ClearAll_Click(object sender, EventArgs e)
|
||||
{
|
||||
for (int i = 0; i < 5; i++)
|
||||
cba[i].SelectedValue = 0;
|
||||
PrevCountries[i].SelectedValue = 0;
|
||||
}
|
||||
|
||||
private class TextMarkup
|
||||
|
|
|
@ -269,8 +269,8 @@ namespace PKHeX.WinForms
|
|||
if (facility < 0 || facility >= BFN.Length) return;
|
||||
editingcont = true;
|
||||
CB_Stats2.Items.Clear();
|
||||
foreach (RadioButton r in StatRBA)
|
||||
r.Checked = false;
|
||||
foreach (RadioButton rb in StatRBA)
|
||||
rb.Checked = false;
|
||||
|
||||
if (BFT[BFF[facility][1]] == null)
|
||||
{
|
||||
|
|
|
@ -562,8 +562,8 @@ namespace PKHeX.WinForms
|
|||
CB_Stats2.Items.AddRange(BFT[BFF[facility][1]]);
|
||||
|
||||
StatRBA[0].Checked = true;
|
||||
foreach (RadioButton r in StatRBA)
|
||||
r.Visible = r.Enabled = facility == 1;
|
||||
foreach (RadioButton rb in StatRBA)
|
||||
rb.Visible = rb.Enabled = facility == 1;
|
||||
|
||||
for (int i = 0; i < StatLabelA.Length; i++)
|
||||
StatLabelA[i].Visible = StatLabelA[i].Enabled = StatNUDA[i].Visible = StatNUDA[i].Enabled = Array.IndexOf(BFV[BFF[facility][0]], i) >= 0;
|
||||
|
|
|
@ -660,8 +660,8 @@ namespace PKHeX.WinForms
|
|||
var source = (SAV.B2W2 ? Encounters5.B2W2_DreamWorld : Encounters5.BW_DreamWorld).ToList();
|
||||
foreach (var s in AllSlots)
|
||||
{
|
||||
int r = Util.Rand.Next(source.Count);
|
||||
var slot = source[r];
|
||||
int index = Util.Rand.Next(source.Count);
|
||||
var slot = source[index];
|
||||
source.Remove(slot);
|
||||
s.Species = slot.Species;
|
||||
s.Form = slot.Form;
|
||||
|
|
|
@ -81,9 +81,9 @@ namespace PKHeX.WinForms
|
|||
|
||||
string[] res2 = { "Rank 4: missions","Rank 8: facility","Rank 10: fashion","Rank 20: rename","Rank 30: special menu","Rank 40: BGM","Rank 50: theme Glitz","Rank 60: theme Fairy","Rank 70: theme Tone","Rank 100: phrase","Current Rank", };
|
||||
CLB_Reward.Items.Clear();
|
||||
CLB_Reward.Items.Add(res2.Last(), (CheckState)r[SAV.GetFestPrizeReceived(10)]); //add CurrentRank before const-rewards
|
||||
CLB_Reward.Items.Add(res2.Last(), (CheckState)RewardState[SAV.GetFestPrizeReceived(10)]); //add CurrentRank before const-rewards
|
||||
for (int i = 0; i < res2.Length - 1; i++)
|
||||
CLB_Reward.Items.Add(res2[i], (CheckState)r[SAV.GetFestPrizeReceived(i)]);
|
||||
CLB_Reward.Items.Add(res2[i], (CheckState)RewardState[SAV.GetFestPrizeReceived(i)]);
|
||||
|
||||
for (int i = 0; i < 7; i++)
|
||||
f[i] = new FestaFacility(SAV, i);
|
||||
|
@ -164,7 +164,7 @@ namespace PKHeX.WinForms
|
|||
}
|
||||
|
||||
private bool editing;
|
||||
private readonly byte[] r = { 0, 2, 1 }; // CheckState.Indeterminate <-> CheckState.Checked
|
||||
private readonly byte[] RewardState = { 0, 2, 1 }; // CheckState.Indeterminate <-> CheckState.Checked
|
||||
private readonly int typeMAX;
|
||||
private readonly FestaFacility[] f = new FestaFacility[7];
|
||||
private readonly string[] RES_Color = { "Red", "Blue", "Gold", "Black", "Purple", "Yellow", "Brown", "Green", "Orange", "NavyBlue", "Pink", "White" };
|
||||
|
@ -264,9 +264,9 @@ namespace PKHeX.WinForms
|
|||
SAV.FestaCoins = (uint)NUD_FC_Current.Value;
|
||||
SAV.FestaDate = new DateTime(CAL_FestaStartDate.Value.Year, CAL_FestaStartDate.Value.Month, CAL_FestaStartDate.Value.Day, CAL_FestaStartTime.Value.Hour, CAL_FestaStartTime.Value.Minute, CAL_FestaStartTime.Value.Second);
|
||||
|
||||
SAV.SetFestaPrizeReceived(10, r[(int)CLB_Reward.GetItemCheckState(0)]);
|
||||
SAV.SetFestaPrizeReceived(10, RewardState[(int)CLB_Reward.GetItemCheckState(0)]);
|
||||
for (int i = 1; i < CLB_Reward.Items.Count; i++)
|
||||
SAV.SetFestaPrizeReceived(i - 1, r[(int)CLB_Reward.GetItemCheckState(i)]);
|
||||
SAV.SetFestaPrizeReceived(i - 1, RewardState[(int)CLB_Reward.GetItemCheckState(i)]);
|
||||
|
||||
SaveFacility();
|
||||
foreach (FestaFacility facility in f)
|
||||
|
|
|
@ -425,14 +425,14 @@ namespace PKHeX.WinForms
|
|||
{
|
||||
if (!GB_SizeRecords.Enabled)
|
||||
return;
|
||||
for (var r = 0; r < RecordUsed.Length; r++)
|
||||
for (var i = 0; i < RecordUsed.Length; i++)
|
||||
{
|
||||
var ck = RecordUsed[r];
|
||||
var ck = RecordUsed[i];
|
||||
if (ck.Checked)
|
||||
continue;
|
||||
ck.Checked = true;
|
||||
RecordHeight[r].Value = r % 2 == 0 ? 0 : 255;
|
||||
RecordWeight[r].Value = r % 2 == 0 ? 0 : 255;
|
||||
RecordHeight[i].Value = i % 2 == 0 ? 0 : 255;
|
||||
RecordWeight[i].Value = i % 2 == 0 ? 0 : 255;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -475,7 +475,7 @@ namespace PKHeX.WinForms
|
|||
|
||||
var tbIsSet = new List<int>();
|
||||
var tbUnSet = new List<int>();
|
||||
var r = new List<string>();
|
||||
var result = new List<string>();
|
||||
bool[] oldBits = s1.EventFlags;
|
||||
bool[] newBits = s2.EventFlags;
|
||||
var oldConst = s1.EventConsts;
|
||||
|
@ -492,17 +492,17 @@ namespace PKHeX.WinForms
|
|||
for (int i = 0; i < newConst.Length; i++)
|
||||
{
|
||||
if (oldConst[i] != newConst[i])
|
||||
r.Add($"{i}: {oldConst[i]}->{newConst[i]}");
|
||||
result.Add($"{i}: {oldConst[i]}->{newConst[i]}");
|
||||
}
|
||||
|
||||
if (r.Count == 0)
|
||||
if (result.Count == 0)
|
||||
{
|
||||
WinFormsUtil.Alert("No Event Constant diff found.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (DialogResult.Yes == WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Copy Event Constant diff to clipboard?"))
|
||||
Clipboard.SetText(string.Join(Environment.NewLine, r));
|
||||
Clipboard.SetText(string.Join(Environment.NewLine, result));
|
||||
}
|
||||
|
||||
private static void Main_DragEnter(object sender, DragEventArgs e)
|
||||
|
|
|
@ -210,8 +210,8 @@ namespace PKHeX.WinForms
|
|||
public TranslationContext(IEnumerable<string> content, char separator = Separator)
|
||||
{
|
||||
var entries = content.Select(z => z.Split(separator)).Where(z => z.Length == 2);
|
||||
foreach (var r in entries.Where(z => !Translation.ContainsKey(z[0])))
|
||||
Translation.Add(r[0], r[1]);
|
||||
foreach (var kvp in entries.Where(z => !Translation.ContainsKey(z[0])))
|
||||
Translation.Add(kvp[0], kvp[1]);
|
||||
}
|
||||
|
||||
public string GetTranslatedText(string val, string fallback)
|
||||
|
|
Loading…
Reference in a new issue