mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-23 12:33:06 +00:00
Expand shorthand parameters
int i => int index, or whatever the value is representing.
This commit is contained in:
parent
a1f5c76790
commit
5c472a400d
27 changed files with 118 additions and 120 deletions
|
@ -17,15 +17,15 @@ namespace PKHeX.Core
|
|||
public int OT_Feeling { get; set; }
|
||||
public int OT_Intensity { get; set; }
|
||||
|
||||
public EncounterTrade8(GameVersion game, int species, int level, int m, int a, int f, int i) : base(game)
|
||||
public EncounterTrade8(GameVersion game, int species, int level, int memory, int arg, int feel, int intensity) : base(game)
|
||||
{
|
||||
Species = species;
|
||||
Level = level;
|
||||
|
||||
OT_Memory = m;
|
||||
OT_TextVar = a;
|
||||
OT_Feeling = f;
|
||||
OT_Intensity = i;
|
||||
OT_Memory = memory;
|
||||
OT_TextVar = arg;
|
||||
OT_Feeling = feel;
|
||||
OT_Intensity = intensity;
|
||||
}
|
||||
|
||||
public override bool IsMatchExact(PKM pkm, DexLevel evo)
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace PKHeX.Core
|
|||
return s;
|
||||
}
|
||||
|
||||
private static string RestrictionSetName(int i) => $"mgrestrict{i}.pkl";
|
||||
private static string RestrictionSetName(int generation) => $"mgrestrict{generation}.pkl";
|
||||
|
||||
private static Dictionary<int, MysteryGiftRestriction> GetRestriction(int generation)
|
||||
{
|
||||
|
|
|
@ -95,11 +95,11 @@ namespace PKHeX.Core
|
|||
/// </summary>
|
||||
public static string GetSource(object parse, int generation, int index)
|
||||
{
|
||||
static string GetLine<T>(T[] arr, Func<T, string> act, int i)
|
||||
static string GetLine<T>(T[] arr, Func<T, string> act, int index)
|
||||
{
|
||||
if (i >= arr.Length)
|
||||
if ((uint)index >= arr.Length)
|
||||
return LMoveSourceEmpty;
|
||||
return act(arr[i]);
|
||||
return act(arr[index]);
|
||||
}
|
||||
|
||||
return generation switch
|
||||
|
|
|
@ -78,9 +78,9 @@ namespace PKHeX.Core
|
|||
return result;
|
||||
}
|
||||
|
||||
private int GetOffsetPKMData(int base_ofs, int i) => base_ofs + (Entry_Size * i);
|
||||
private int GetOffsetPKMOT(int base_ofs, int i) => GetOffsetPKMData(base_ofs, Capacity) + (StringLength * i);
|
||||
private int GetOffsetPKMNickname(int base_ofs, int i) => GetOffsetPKMOT(base_ofs, Capacity) + (StringLength * i);
|
||||
private int GetOffsetPKMData(int base_ofs, int index) => base_ofs + (Entry_Size * index);
|
||||
private int GetOffsetPKMOT(int base_ofs, int index) => GetOffsetPKMData(base_ofs, Capacity) + (StringLength * index);
|
||||
private int GetOffsetPKMNickname(int base_ofs, int index) => GetOffsetPKMOT(base_ofs, Capacity) + (StringLength * index);
|
||||
|
||||
private static int GetStringLength(bool jp) => jp ? GBPKML.StringLengthJapanese : GBPKML.StringLengthNotJapan;
|
||||
protected bool IsFormatParty => IsCapacityPartyFormat((PokeListType)Capacity);
|
||||
|
@ -131,26 +131,26 @@ namespace PKHeX.Core
|
|||
return Data;
|
||||
}
|
||||
|
||||
private T GetEntry(int base_ofs, int i)
|
||||
private T GetEntry(int base_ofs, int index)
|
||||
{
|
||||
int pkOfs = GetOffsetPKMData(base_ofs, i);
|
||||
int otOfs = GetOffsetPKMOT(base_ofs, i);
|
||||
int nkOfs = GetOffsetPKMNickname(base_ofs, i);
|
||||
int pkOfs = GetOffsetPKMData(base_ofs, index);
|
||||
int otOfs = GetOffsetPKMOT(base_ofs, index);
|
||||
int nkOfs = GetOffsetPKMNickname(base_ofs, index);
|
||||
|
||||
var dat = Data.Slice(pkOfs, Entry_Size);
|
||||
var otname = Data.Slice(otOfs, StringLength);
|
||||
var nick = Data.Slice(nkOfs, StringLength);
|
||||
|
||||
return GetEntry(dat, otname, nick, Data[1 + i] == 0xFD);
|
||||
return GetEntry(dat, otname, nick, Data[1 + index] == 0xFD);
|
||||
}
|
||||
|
||||
private void SetEntry(int base_ofs, int i)
|
||||
private void SetEntry(int base_ofs, int index)
|
||||
{
|
||||
int pkOfs = GetOffsetPKMData(base_ofs, i);
|
||||
int otOfs = GetOffsetPKMOT(base_ofs, i);
|
||||
int nkOfs = GetOffsetPKMNickname(base_ofs, i);
|
||||
int pkOfs = GetOffsetPKMData(base_ofs, index);
|
||||
int otOfs = GetOffsetPKMOT(base_ofs, index);
|
||||
int nkOfs = GetOffsetPKMNickname(base_ofs, index);
|
||||
|
||||
var pk = Pokemon[i];
|
||||
var pk = Pokemon[index];
|
||||
Array.Copy(pk.Data, 0, Data, pkOfs, Entry_Size);
|
||||
pk.RawOT.CopyTo(Data, otOfs);
|
||||
pk.RawNickname.CopyTo(Data, nkOfs);
|
||||
|
|
|
@ -72,14 +72,14 @@ namespace PKHeX.Core
|
|||
return text[(8 + 3 + 4 + 1)..];
|
||||
}
|
||||
|
||||
private string GetBlockHint(SCBlock z, int i)
|
||||
private string GetBlockHint(SCBlock z, int index)
|
||||
{
|
||||
var blockName = GetBlockName(z, out _);
|
||||
var isBool = z.Type.IsBoolean();
|
||||
var type = (isBool ? "Bool" : z.Type.ToString());
|
||||
if (blockName != null)
|
||||
return $"*{type} {blockName}";
|
||||
var result = $"{z.Key:X8} - {i:0000} {type}";
|
||||
var result = $"{z.Key:X8} - {index:0000} {type}";
|
||||
if (z.Type is SCTypeCode.Object or SCTypeCode.Array)
|
||||
result += $" 0x{z.Data.Length:X3}";
|
||||
else if (!isBool)
|
||||
|
|
|
@ -175,11 +175,11 @@ namespace PKHeX.Core
|
|||
return outData;
|
||||
}
|
||||
|
||||
private int GetBoxRawDataOffset(int i)
|
||||
private int GetBoxRawDataOffset(int box)
|
||||
{
|
||||
if (i < BoxCount / 2)
|
||||
return 0x4000 + (i * SIZE_STOREDBOX);
|
||||
return 0x6000 + ((i - (BoxCount / 2)) * SIZE_STOREDBOX);
|
||||
if (box < BoxCount / 2)
|
||||
return 0x4000 + (box * SIZE_STOREDBOX);
|
||||
return 0x6000 + ((box - (BoxCount / 2)) * SIZE_STOREDBOX);
|
||||
}
|
||||
|
||||
// Configuration
|
||||
|
|
|
@ -71,26 +71,26 @@ namespace PKHeX.Core
|
|||
ClearBoxes();
|
||||
}
|
||||
|
||||
protected override bool GetIsBoxChecksumValid(int i)
|
||||
protected override bool GetIsBoxChecksumValid(int box)
|
||||
{
|
||||
var boxOfs = GetBoxOffset(i) - ListHeaderSize;
|
||||
var boxOfs = GetBoxOffset(box) - ListHeaderSize;
|
||||
var size = BoxSize - 2;
|
||||
var chk = Checksums.CheckSum16(new ReadOnlySpan<byte>(Data, boxOfs, size));
|
||||
var actual = BigEndian.ToUInt16(Data, boxOfs + size);
|
||||
return chk == actual;
|
||||
}
|
||||
|
||||
protected override void SetBoxChecksum(int i)
|
||||
protected override void SetBoxChecksum(int box)
|
||||
{
|
||||
var boxOfs = GetBoxOffset(i) - ListHeaderSize;
|
||||
var boxOfs = GetBoxOffset(box) - ListHeaderSize;
|
||||
var size = BoxSize - 2;
|
||||
var chk = Checksums.CheckSum16(new ReadOnlySpan<byte>(Data, boxOfs, size));
|
||||
BigEndian.GetBytes(chk).CopyTo(Data, boxOfs + size);
|
||||
}
|
||||
|
||||
protected override void SetBoxMetadata(int i)
|
||||
protected override void SetBoxMetadata(int box)
|
||||
{
|
||||
var bdata = GetBoxOffset(i);
|
||||
var bdata = GetBoxOffset(box);
|
||||
|
||||
// Set box count
|
||||
int count = 0;
|
||||
|
|
|
@ -56,24 +56,24 @@ namespace PKHeX.Core
|
|||
ClearBoxes();
|
||||
}
|
||||
|
||||
protected override bool GetIsBoxChecksumValid(int i)
|
||||
protected override bool GetIsBoxChecksumValid(int box)
|
||||
{
|
||||
var boxOfs = GetBoxOffset(i) - ListHeaderSize;
|
||||
var boxOfs = GetBoxOffset(box) - ListHeaderSize;
|
||||
const int size = BoxSizeJ - 2;
|
||||
var chk = Checksums.CheckSum16(new ReadOnlySpan<byte>(Data, boxOfs, size));
|
||||
var actual = BigEndian.ToUInt16(Data, boxOfs + size);
|
||||
return chk == actual;
|
||||
}
|
||||
|
||||
protected override void SetBoxChecksum(int i)
|
||||
protected override void SetBoxChecksum(int box)
|
||||
{
|
||||
var boxOfs = GetBoxOffset(i) - ListHeaderSize;
|
||||
var boxOfs = GetBoxOffset(box) - ListHeaderSize;
|
||||
const int size = BoxSizeJ - 2;
|
||||
var chk = Checksums.CheckSum16(new ReadOnlySpan<byte>(Data, boxOfs, size));
|
||||
BigEndian.GetBytes(chk).CopyTo(Data, boxOfs + size);
|
||||
}
|
||||
|
||||
protected override void SetBoxMetadata(int i)
|
||||
protected override void SetBoxMetadata(int box)
|
||||
{
|
||||
// Not implemented
|
||||
}
|
||||
|
|
|
@ -69,18 +69,18 @@ namespace PKHeX.Core
|
|||
ClearBoxes();
|
||||
}
|
||||
|
||||
protected override bool GetIsBoxChecksumValid(int i)
|
||||
protected override bool GetIsBoxChecksumValid(int box)
|
||||
{
|
||||
var boxOfs = GetBoxOffset(i) - ListHeaderSizeBox;
|
||||
var boxOfs = GetBoxOffset(box) - ListHeaderSizeBox;
|
||||
var size = BoxSize - 2;
|
||||
var chk = Checksums.CheckSum16(new ReadOnlySpan<byte>(Data, boxOfs, size));
|
||||
var actual = BigEndian.ToUInt16(Data, boxOfs + size);
|
||||
return chk == actual;
|
||||
}
|
||||
|
||||
protected override void SetBoxMetadata(int i)
|
||||
protected override void SetBoxMetadata(int box)
|
||||
{
|
||||
var bdata = GetBoxOffset(i);
|
||||
var bdata = GetBoxOffset(box);
|
||||
|
||||
// Set box count
|
||||
int count = 0;
|
||||
|
@ -105,9 +105,9 @@ namespace PKHeX.Core
|
|||
}
|
||||
}
|
||||
|
||||
protected override void SetBoxChecksum(int i)
|
||||
protected override void SetBoxChecksum(int box)
|
||||
{
|
||||
var boxOfs = GetBoxOffset(i) - ListHeaderSizeBox;
|
||||
var boxOfs = GetBoxOffset(box) - ListHeaderSizeBox;
|
||||
var size = BoxSize - 2;
|
||||
var chk = Checksums.CheckSum16(new ReadOnlySpan<byte>(Data, boxOfs, size));
|
||||
BigEndian.GetBytes(chk).CopyTo(Data, boxOfs + size);
|
||||
|
|
|
@ -555,9 +555,9 @@ namespace PKHeX.Core
|
|||
protected abstract int MailOffset { get; }
|
||||
public int GetMailOffset(int index) => (index * Mail3.SIZE) + MailOffset;
|
||||
|
||||
public Mail GetMail(int i)
|
||||
public Mail GetMail(int mailIndex)
|
||||
{
|
||||
var ofs = GetMailOffset(i);
|
||||
var ofs = GetMailOffset(mailIndex);
|
||||
var data = Large.Slice(ofs, Mail3.SIZE);
|
||||
return new Mail3(data, ofs, Japanese);
|
||||
}
|
||||
|
|
|
@ -534,9 +534,9 @@ namespace PKHeX.Core
|
|||
|
||||
public byte[] GetMailData(int ofs) => General.Slice(ofs, Mail4.SIZE);
|
||||
|
||||
public Mail4 GetMail(int i)
|
||||
public Mail4 GetMail(int mailIndex)
|
||||
{
|
||||
int ofs = GetMailOffset(i);
|
||||
int ofs = GetMailOffset(mailIndex);
|
||||
return new Mail4(GetMailData(ofs), ofs);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -220,8 +220,8 @@ namespace PKHeX.Core
|
|||
}
|
||||
|
||||
// Apricorn Pouch
|
||||
public int GetApricornCount(int i) => General[0xE558 + i];
|
||||
public void SetApricornCount(int i, int count) => General[0xE558 + i] = (byte)count;
|
||||
public int GetApricornCount(int index) => General[0xE558 + index];
|
||||
public void SetApricornCount(int index, int count) => General[0xE558 + index] = (byte)count;
|
||||
|
||||
// Pokewalker
|
||||
public const int WalkerPair = 0xE5E0;
|
||||
|
|
|
@ -210,9 +210,9 @@ namespace PKHeX.Core
|
|||
public byte[] GetMailData(int offset) => GetData(offset, Mail5.SIZE);
|
||||
public int GetBattleBoxSlot(int slot) => BattleBoxOffset + (slot * SIZE_STORED);
|
||||
|
||||
public Mail GetMail(int i)
|
||||
public Mail GetMail(int mailIndex)
|
||||
{
|
||||
int ofs = GetMailOffset(i);
|
||||
int ofs = GetMailOffset(mailIndex);
|
||||
var data = GetMailData(ofs);
|
||||
return new Mail5(data, ofs);
|
||||
}
|
||||
|
|
|
@ -48,10 +48,10 @@
|
|||
public sealed override void SetBoxName(int box, string value) { }
|
||||
public sealed override bool ChecksumsValid => GetBoxChecksumsValid();
|
||||
public sealed override string ChecksumInfo => ChecksumsValid ? "Checksum valid." : "Checksum invalid";
|
||||
protected abstract void SetBoxChecksum(int i);
|
||||
protected abstract bool GetIsBoxChecksumValid(int i);
|
||||
protected abstract void SetBoxChecksum(int box);
|
||||
protected abstract bool GetIsBoxChecksumValid(int box);
|
||||
protected sealed override void SetChecksums() => SetBoxChecksums();
|
||||
protected abstract void SetBoxMetadata(int i);
|
||||
protected abstract void SetBoxMetadata(int box);
|
||||
|
||||
protected void SetBoxChecksums()
|
||||
{
|
||||
|
|
|
@ -290,9 +290,9 @@ namespace PKHeX.Core
|
|||
return true;
|
||||
}
|
||||
|
||||
private bool IsPartySlotNotEggOrEmpty(int i)
|
||||
private bool IsPartySlotNotEggOrEmpty(int index)
|
||||
{
|
||||
var slot = GetPartySlotAtIndex(i);
|
||||
var slot = GetPartySlotAtIndex(index);
|
||||
return !slot.IsEgg && slot.Species != 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,19 +15,15 @@ namespace PKHeX.Core
|
|||
int eCount = data.Length/SIZE_ENTRY;
|
||||
Entries = new ShadowInfoEntryXD[eCount];
|
||||
for (int i = 0; i < eCount; i++)
|
||||
{
|
||||
var entry = GetEntry(data, i);
|
||||
Entries[i] = entry;
|
||||
}
|
||||
Entries[i] = GetEntry(data, i);
|
||||
}
|
||||
|
||||
public ShadowInfoTableXD() : this(new byte[SIZE_ENTRY * MaxCount]) { }
|
||||
|
||||
private static ShadowInfoEntryXD GetEntry(byte[] data, int i)
|
||||
private static ShadowInfoEntryXD GetEntry(byte[] data, int index)
|
||||
{
|
||||
var d = data.Slice(i * SIZE_ENTRY, SIZE_ENTRY);
|
||||
var entry = new ShadowInfoEntryXD(d);
|
||||
return entry;
|
||||
var slice = data.Slice(index * SIZE_ENTRY, SIZE_ENTRY);
|
||||
return new ShadowInfoEntryXD(slice);
|
||||
}
|
||||
|
||||
public byte[] Write() => Entries.SelectMany(entry => entry.Data).Take(MaxLength).ToArray();
|
||||
|
|
|
@ -19,8 +19,8 @@ namespace PKHeX.Core
|
|||
Offset = offset;
|
||||
}
|
||||
|
||||
private int GetMemberOffset(int i) => Offset + (i * HallFame3PKM.SIZE);
|
||||
private HallFame3PKM GetMember(int i) => new(Parent, GetMemberOffset(i), Japanese);
|
||||
private int GetMemberOffset(int index) => Offset + (index * HallFame3PKM.SIZE);
|
||||
private HallFame3PKM GetMember(int index) => new(Parent, GetMemberOffset(index), Japanese);
|
||||
|
||||
public HallFame3PKM[] Team
|
||||
{
|
||||
|
|
|
@ -11,10 +11,10 @@ namespace PKHeX.Core
|
|||
private const int O_Level = 0x3C;
|
||||
private const int O_EV = 0x42;
|
||||
|
||||
private static int GetOffsetPID(int i) => O_PID + (i * 4);
|
||||
private static int GetOffsetMove(int i, int move) => O_Moves + (i * 8) + (move * 2);
|
||||
private static int GetOffsetSpecies(int i) => O_Species + (i * 2);
|
||||
private static int GetOffsetItem(int i) => O_Item + (i * 2);
|
||||
private static int GetOffsetPID(int index) => O_PID + (index * 4);
|
||||
private static int GetOffsetMove(int index, int move) => O_Moves + (index * 8) + (move * 2);
|
||||
private static int GetOffsetSpecies(int index) => O_Species + (index * 2);
|
||||
private static int GetOffsetItem(int index) => O_Item + (index * 2);
|
||||
|
||||
public readonly SecretBase3PKM[] Team;
|
||||
private readonly byte[] Data;
|
||||
|
@ -34,34 +34,34 @@ namespace PKHeX.Core
|
|||
return Data;
|
||||
}
|
||||
|
||||
private SecretBase3PKM GetPKM(int i)
|
||||
private SecretBase3PKM GetPKM(int index)
|
||||
{
|
||||
return new()
|
||||
{
|
||||
PID = BitConverter.ToUInt32(Data, GetOffsetPID(i)),
|
||||
Species = BitConverter.ToUInt16(Data, GetOffsetSpecies(i)),
|
||||
HeldItem = BitConverter.ToUInt16(Data, GetOffsetItem(i)),
|
||||
Move1 = BitConverter.ToUInt16(Data, GetOffsetMove(i, 0)),
|
||||
Move2 = BitConverter.ToUInt16(Data, GetOffsetMove(i, 1)),
|
||||
Move3 = BitConverter.ToUInt16(Data, GetOffsetMove(i, 2)),
|
||||
Move4 = BitConverter.ToUInt16(Data, GetOffsetMove(i, 3)),
|
||||
Level = Data[O_Level + i],
|
||||
EVAll = Data[O_EV + i],
|
||||
PID = BitConverter.ToUInt32(Data, GetOffsetPID(index)),
|
||||
Species = BitConverter.ToUInt16(Data, GetOffsetSpecies(index)),
|
||||
HeldItem = BitConverter.ToUInt16(Data, GetOffsetItem(index)),
|
||||
Move1 = BitConverter.ToUInt16(Data, GetOffsetMove(index, 0)),
|
||||
Move2 = BitConverter.ToUInt16(Data, GetOffsetMove(index, 1)),
|
||||
Move3 = BitConverter.ToUInt16(Data, GetOffsetMove(index, 2)),
|
||||
Move4 = BitConverter.ToUInt16(Data, GetOffsetMove(index, 3)),
|
||||
Level = Data[O_Level + index],
|
||||
EVAll = Data[O_EV + index],
|
||||
};
|
||||
}
|
||||
|
||||
private void SetPKM(int i)
|
||||
private void SetPKM(int index)
|
||||
{
|
||||
var pk = Team[i];
|
||||
BitConverter.GetBytes(pk.PID).CopyTo(Data, GetOffsetPID(i));
|
||||
BitConverter.GetBytes((ushort)pk.Species).CopyTo(Data, GetOffsetSpecies(i));
|
||||
BitConverter.GetBytes((ushort)pk.HeldItem).CopyTo(Data, GetOffsetItem(i));
|
||||
BitConverter.GetBytes((ushort)pk.Move1).CopyTo(Data, GetOffsetMove(i, 0));
|
||||
BitConverter.GetBytes((ushort)pk.Move2).CopyTo(Data, GetOffsetMove(i, 1));
|
||||
BitConverter.GetBytes((ushort)pk.Move3).CopyTo(Data, GetOffsetMove(i, 2));
|
||||
BitConverter.GetBytes((ushort)pk.Move4).CopyTo(Data, GetOffsetMove(i, 3));
|
||||
Data[O_Level + i] = (byte) pk.Level;
|
||||
Data[O_EV + i] = (byte) pk.EVAll;
|
||||
var pk = Team[index];
|
||||
BitConverter.GetBytes(pk.PID).CopyTo(Data, GetOffsetPID(index));
|
||||
BitConverter.GetBytes((ushort)pk.Species).CopyTo(Data, GetOffsetSpecies(index));
|
||||
BitConverter.GetBytes((ushort)pk.HeldItem).CopyTo(Data, GetOffsetItem(index));
|
||||
BitConverter.GetBytes((ushort)pk.Move1).CopyTo(Data, GetOffsetMove(index, 0));
|
||||
BitConverter.GetBytes((ushort)pk.Move2).CopyTo(Data, GetOffsetMove(index, 1));
|
||||
BitConverter.GetBytes((ushort)pk.Move3).CopyTo(Data, GetOffsetMove(index, 2));
|
||||
BitConverter.GetBytes((ushort)pk.Move4).CopyTo(Data, GetOffsetMove(index, 3));
|
||||
Data[O_Level + index] = (byte)pk.Level;
|
||||
Data[O_EV + index] = (byte)pk.EVAll;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -97,8 +97,8 @@ namespace PKHeX.Core
|
|||
set => ConfigValue = ((ConfigValue & ~0xF0) | SetLanguageID(value) << 4);
|
||||
}
|
||||
|
||||
private static int GetLanguageID(int i) => i >= (int)LanguageID.UNUSED_6 ? i + 1 : i; // sets langBank to LanguageID
|
||||
private static int SetLanguageID(int i) => i > (int)LanguageID.UNUSED_6 ? i - 1 : i; // sets LanguageID to langBank
|
||||
private static int GetLanguageID(int rawValue) => rawValue >= (int)LanguageID.UNUSED_6 ? rawValue + 1 : rawValue; // sets langBank to LanguageID
|
||||
private static int SetLanguageID(int rawValue) => rawValue > (int)LanguageID.UNUSED_6 ? rawValue - 1 : rawValue; // sets LanguageID to langBank
|
||||
|
||||
public enum BattleAnimationSetting
|
||||
{
|
||||
|
|
|
@ -69,8 +69,8 @@ namespace PKHeX.Core
|
|||
set => ConfigValue = ((ConfigValue & ~0xF0) | SetLanguageID(value) << 4);
|
||||
}
|
||||
|
||||
private static int GetLanguageID(int i) => i >= (int)LanguageID.UNUSED_6 ? i + 1 : i; // sets langBank to LanguageID
|
||||
private static int SetLanguageID(int i) => i > (int)LanguageID.UNUSED_6 ? i - 1 : i; // sets LanguageID to langBank
|
||||
private static int GetLanguageID(int rawValue) => rawValue >= (int)LanguageID.UNUSED_6 ? rawValue + 1 : rawValue; // sets langBank to LanguageID
|
||||
private static int SetLanguageID(int rawValue) => rawValue > (int)LanguageID.UNUSED_6 ? rawValue - 1 : rawValue; // sets LanguageID to langBank
|
||||
|
||||
public enum BattleAnimationSetting
|
||||
{
|
||||
|
|
|
@ -50,8 +50,8 @@ namespace PKHeX.Core
|
|||
set => ConfigValue = ((ConfigValue & ~0xF0) | SetLanguageID(value) << 4);
|
||||
}
|
||||
|
||||
private static int GetLanguageID(int i) => i >= (int) LanguageID.UNUSED_6 ? i + 1 : i; // sets langBank to LanguageID
|
||||
private static int SetLanguageID(int i) => i > (int) LanguageID.UNUSED_6 ? i - 1 : i; // sets LanguageID to langBank
|
||||
private static int GetLanguageID(int rawValue) => rawValue >= (int) LanguageID.UNUSED_6 ? rawValue + 1 : rawValue; // sets langBank to LanguageID
|
||||
private static int SetLanguageID(int rawValue) => rawValue > (int) LanguageID.UNUSED_6 ? rawValue - 1 : rawValue; // sets LanguageID to langBank
|
||||
|
||||
public enum BattleAnimationSetting
|
||||
{
|
||||
|
|
|
@ -92,11 +92,11 @@ namespace PKHeX.Core
|
|||
return false;
|
||||
}
|
||||
|
||||
public bool GetSeen(int species, int i) => GetFlag(OFS_SEEN + (i * BitSeenSize), species - 1);
|
||||
public void SetSeen(int species, int i, bool value) => SetFlag(OFS_SEEN + (i * BitSeenSize), species - 1, value);
|
||||
public bool GetSeen(int species, int bitRegion) => GetFlag(OFS_SEEN + (bitRegion * BitSeenSize), species - 1);
|
||||
public void SetSeen(int species, int bitRegion, bool value) => SetFlag(OFS_SEEN + (bitRegion * BitSeenSize), species - 1, value);
|
||||
|
||||
public bool GetDisplayed(int bit, int i) => GetFlag(OFS_SEEN + ((i + 4) * BitSeenSize), bit);
|
||||
public void SetDisplayed(int bit, int i, bool value) => SetFlag(OFS_SEEN + ((i + 4) * BitSeenSize), bit, value);
|
||||
public bool GetDisplayed(int bit, int bitRegion) => GetFlag(OFS_SEEN + ((bitRegion + 4) * BitSeenSize), bit);
|
||||
public void SetDisplayed(int bit, int bitRegion, bool value) => SetFlag(OFS_SEEN + ((bitRegion + 4) * BitSeenSize), bit, value);
|
||||
|
||||
public bool GetLanguageFlag(int bit, int lang) => GetFlag(PokeDexLanguageFlags, (bit * DexLangIDCount) + lang);
|
||||
public void SetLanguageFlag(int bit, int lang, bool value) => SetFlag(PokeDexLanguageFlags, (bit * DexLangIDCount) + lang, value);
|
||||
|
|
|
@ -228,12 +228,12 @@ namespace PKHeX.WinForms
|
|||
mi.Invoke();
|
||||
}
|
||||
|
||||
private void SetProgressBar(int i)
|
||||
private void SetProgressBar(int position)
|
||||
{
|
||||
if (PB_Show.InvokeRequired)
|
||||
PB_Show.Invoke((MethodInvoker)(() => PB_Show.Value = i));
|
||||
PB_Show.Invoke((MethodInvoker)(() => PB_Show.Value = position));
|
||||
else
|
||||
PB_Show.Value = i;
|
||||
PB_Show.Value = position;
|
||||
}
|
||||
|
||||
// Mass Editing
|
||||
|
|
|
@ -356,9 +356,9 @@ namespace PKHeX.WinForms
|
|||
cm.ResumeBinding();
|
||||
}
|
||||
|
||||
private static void ToggleRowVisibility(DataGridView dg, int column, string text, int i)
|
||||
private static void ToggleRowVisibility(DataGridView dg, int column, string text, int rowIndex)
|
||||
{
|
||||
var row = dg.Rows[i];
|
||||
var row = dg.Rows[rowIndex];
|
||||
if (text.Length == 0 || column < 0)
|
||||
{
|
||||
row.Visible = true;
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace PKHeX.WinForms
|
|||
Updating = false;
|
||||
}
|
||||
|
||||
private string GetPoffinText(int i) => $"{i + 1:000} - {Case.Poffins[i].Type.ToString().Replace('_', '-')}";
|
||||
private string GetPoffinText(int index) => $"{index + 1:000} - {Case.Poffins[index].Type.ToString().Replace('_', '-')}";
|
||||
|
||||
public void Save()
|
||||
{
|
||||
|
@ -38,24 +38,24 @@ namespace PKHeX.WinForms
|
|||
Case.Save();
|
||||
}
|
||||
|
||||
private void SaveIndex(int i)
|
||||
private void SaveIndex(int index)
|
||||
{
|
||||
// do nothing, propertygrid handles everything
|
||||
if (i < 0)
|
||||
if (index < 0)
|
||||
return;
|
||||
Updating = true;
|
||||
LB_Poffins.Items[i] = GetPoffinText(i);
|
||||
LB_Poffins.Items[index] = GetPoffinText(index);
|
||||
Updating = false;
|
||||
}
|
||||
|
||||
private void LoadIndex(int i)
|
||||
private void LoadIndex(int index)
|
||||
{
|
||||
if (i < 0)
|
||||
if (index < 0)
|
||||
{
|
||||
LB_Poffins.SelectedIndex = 0;
|
||||
return;
|
||||
}
|
||||
PG_Poffins.SelectedObject = Case.Poffins[i];
|
||||
PG_Poffins.SelectedObject = Case.Poffins[index];
|
||||
}
|
||||
|
||||
private void LB_Poffins_SelectedIndexChanged(object sender, EventArgs e)
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using PKHeX.Core;
|
||||
|
||||
|
|
|
@ -224,10 +224,13 @@ namespace PKHeX.WinForms
|
|||
};
|
||||
}
|
||||
|
||||
private int GetColorCount(int i) =>
|
||||
i >= 0 && i < RES_FacilityColor.Length - (SAV is SAV7USUM ? 0 : 1)
|
||||
? RES_FacilityColor[i].Length - 1
|
||||
: 3;
|
||||
private int GetColorCount(int type)
|
||||
{
|
||||
var colors = RES_FacilityColor;
|
||||
if (type >= 0 && type < colors.Length - (SAV is SAV7USUM ? 0 : 1))
|
||||
return colors[type].Length - 1;
|
||||
return 3;
|
||||
}
|
||||
|
||||
private void LoadFacility()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue